package com.nbsaas.boot.product.rest.convert;

import com.nbsaas.boot.product.data.entity.ProductSkuSpecValue;
import com.nbsaas.boot.product.api.domain.simple.ProductSkuSpecValueSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* 商品SKU规格值-列表对象转换器
*/

public class ProductSkuSpecValueSimpleConvert implements Converter<ProductSkuSpecValueSimple, ProductSkuSpecValue> {




@Override
public ProductSkuSpecValueSimple convert(ProductSkuSpecValue source) {
    ProductSkuSpecValueSimple result = new ProductSkuSpecValueSimple();


                try {
                    if(source.getSpecValue()!=null){
                        result.setSpecValueName(source.getSpecValue().getName());
                    }
                } catch (Exception ignored) { }


               try {
                   if(source.getProductSku()!=null){
                       result.setProductSku(source.getProductSku().getId());
                   }
                } catch (Exception ignored) { }

                result.setProductId(source.getProductId());

                try {
                    if(source.getProductSku()!=null){
                        result.setProductSkuName(source.getProductSku().getName());
                    }
                } catch (Exception ignored) { }


               try {
                   if(source.getSpecValue()!=null){
                       result.setSpecValue(source.getSpecValue().getId());
                   }
                } catch (Exception ignored) { }

                result.setSortNum(source.getSortNum());
                result.setId(source.getId());


    return result;
}

}